<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../bootstrap/bootstrap.min.css">
    <script src="../jquery/jquery-1.8.3.js"></script>
</head>
<style type="text/css">
    .div_ads {
        width: 75%;
        margin: 50px auto 0 0;
    }

    table {
        margin: 0 auto;
        width:100%;
        border-collapse:separate;
        border-spacing:0px 10px;
    }
    table tr td {
        text-align: center;
        width:150px;
        height:44px;
    }
</style>
<script>
    $(function () {
        //获取会话对象中的键值对
        // var stuNum = sessionStorage.getItem('userNum');

        //使用ajax请求servlet---数据库
        $.ajax({
            url:"/StuTea/ServletupAdmin",
            dataType:"json",
            contentType: "Application/json",
            data:{

            },
            success:function (data) {
                //解析返回数据,填充到HTML中,不需要使用EL或JSTL
                if(data != null && data !=""){
                    $("#num").val(data.userNum);//这个.userNum是返回的json数据里的数据
                    $("#name").val(data.userName);
                    $("#password").val(data.password);
                    $("#phone").val(data.phone);
                    $("#role").val(data.roleId);
                }
            }
        })

        //
        // var span = $("span").val();
        // if(span!=null){
        //     span.val("修改成了")
        // }




    })
</script>

<!-- action我只写ServletEditTeacherInfo。浏览器端报404路径/StuTea/teacher/ServletEditTeacherInfo,所以浏览器默认是从webapp里开始找起的。java文件下的写绝对路径。-->
<body>
<form action="/StuTea/ServletEditAdminInfo" method="post">
    <div class="div_ads">
        <span></span>
        <table>
            <tr>
                <td>账&nbsp;&nbsp;&nbsp;号：</td>
                <td><input type="text" id="num" name="userNum" class="form-control" value="" readonly="readonly" /></td>
            </tr>
            <tr>
                <td>姓&nbsp;&nbsp;&nbsp;名：</td>
                <td><input type="text" id="name" name="userName" class="form-control" value="" /></td>
            </tr>
            <tr>
                <td>密&nbsp;&nbsp;&nbsp;码：</td>
                <td><input type="text"  id="password"  name="password" class="form-control" value="" /></td>
            </tr>
            <tr>
                <td>电话号码：</td>
                <td><input type="text"  id="phone"  name="phone" class="form-control" value="" /></td>
            </tr>
            <tr>
                <td>角&nbsp;&nbsp;&nbsp;色：</td>
                <td><input type="text"  id="role" name="roleId" class="form-control" value="" /></td>
            </tr>
            <tr>
                <td></td>
                <td></td>
            </tr>
            <tr>
                <td><input type="submit" value="修改" class="btn btn-primary" /></td>
                <td><input type="reset"  value="清空" class="btn btn-danger" /></td>
<!--                <span id="span" value="12">afafaf</span>-->
            </tr>
        </table>
    </div>
</form>
</body>
</html>